From: Camila Ayres Date: Tue, 8 Apr 2025 13:35:55 +0000 (+0200) Subject: test(cfapi): check for spurious attribute changes. X-Git-Tag: archive/raspbian/3.16.7-1_deb13u1+rpi1~1^2~12^2^2~29^2 X-Git-Url: https://dgit.raspbian.org/%22http:/www.example.com/cgi/%22https://%22Program/%22http:/www.example.com/cgi/%22https:/%22Program?a=commitdiff_plain;h=f4146a621b4af0fa6a54489d64f30968d1455c58;p=nextcloud-desktop.git test(cfapi): check for spurious attribute changes. Signed-off-by: Camila Ayres --- diff --git a/test/testsynccfapi.cpp b/test/testsynccfapi.cpp index d1ef2994e..20f509cb6 100644 --- a/test/testsynccfapi.cpp +++ b/test/testsynccfapi.cpp @@ -1449,6 +1449,43 @@ private slots: QVERIFY(fakeFolder.syncOnce()); QCOMPARE(fakeFolder.currentLocalState(), fakeFolder.currentRemoteState()); } + + void testDetectSpuriousNotification() { +#if !defined Q_OS_WIN + QSKIP("not applicable"); +#endif + FakeFolder fakeFolder{FileInfo{}}; + auto vfs = setupVfs(fakeFolder); + + QVERIFY(fakeFolder.syncOnce()); + QCOMPARE(fakeFolder.currentLocalState(), fakeFolder.currentRemoteState()); + + const QString odpFile("odp/presentation.odp"); + const QString odtFile("odt/document.odt"); + fakeFolder.localModifier().mkdir("odp"); + fakeFolder.localModifier().insert(odpFile); + fakeFolder.localModifier().mkdir("odt"); + fakeFolder.localModifier().insert(odtFile); + + QVERIFY(fakeFolder.syncOnce()); + QCOMPARE(fakeFolder.currentLocalState(), fakeFolder.currentRemoteState()); + ItemCompletedSpy completeSpy(fakeFolder); + + QFile odp(fakeFolder.localPath() + odpFile); + QVERIFY(odp.open(QIODevice::ReadWrite)); + odp.write(odpFile.toLatin1(), qstrlen(odpFile.toLatin1())); + odp.close(); + QVERIFY(fakeFolder.syncOnce()); + QVERIFY(itemInstruction(completeSpy, odpFile, CSYNC_INSTRUCTION_SYNC)); + QCOMPARE(*vfs->pinState(odpFile), PinState::Unspecified); + + QFile odt(fakeFolder.localPath() + odtFile); + QVERIFY(odt.open(QIODevice::ReadWrite)); + odt.close(); + QVERIFY(fakeFolder.syncOnce()); + QVERIFY(itemInstruction(completeSpy, odtFile, CSYNC_INSTRUCTION_UPDATE_METADATA)); + QCOMPARE(*vfs->pinState(odtFile), PinState::Unspecified); + } }; QTEST_GUILESS_MAIN(TestSyncCfApi)